Skip to content

Instantly share code, notes, and snippets.

View berkaytumal's full-sized avatar

Berkay Tumal berkaytumal

  • İstanbul
  • 08:49 (UTC +03:00)
View GitHub Profile
function applyOverscroll(bs){bs.options.outOfBoundaryDampingFactor=1,bs.refresh();const content=bs.content,wrapper=bs.wrapper;function overscrollBounce(transformStyle,x,y){const max=[bs.maxScrollX,bs.maxScrollY],maxBounce=125,scale=58/62;var newScale=[1,1];x>125?transformStyle.push(`translateX(${125-x}px)`):x<max[0]-125&&transformStyle.push(`translateX(${max-x+125}px)`),y>125?transformStyle.push(`translateY(${125-y}px)`):y<max[1]-125&&transformStyle.push(`translateY(${max-y+125}px)`),x=Math.min(125,Math.max(max[0]-125,x)),y=Math.min(125,Math.max(max[1]-125,y)),x>0?newScale[0]=1-x*(1-58/62)/125:x<max[0]&&(newScale[0]=1-(max[0]-x)*(1-58/62)/125),y>0?newScale[1]=1-y*(1-58/62)/125:y<max[1]&&(newScale[1]=1-(max[1]-y)*(1-58/62)/125),x>0?content.style.setProperty("-webkit-transform-origin-x","0%"):x<max[0]&&content.style.setProperty("-webkit-transform-origin-x","100%"),y>0?content.style.setProperty("-webkit-transform-origin-y","0%"):y<max[1]&&content.style.setProperty("-webkit-transform-origin-y","100%"),1!=newScale
const iSpring = {
helpers: {
transition: (firstInput, secondInput, transitionValue) => {
if (typeof firstInput == "number") {
return firstInput + (secondInput - firstInput) * transitionValue;
} else {
var result = [];
for (var i = 0; i < firstInput.length; i++) {
result[i] = firstInput[i] + (secondInput[i] - firstInput[i]) * transitionValue;
}
@berkaytumal
berkaytumal / icupertinowallpapers.json
Last active March 24, 2024 19:41
iCupertino Wallpapers
[ {
"name": "iPhone 15 01",
"author": "iOS Stock",
"url": "https://9to5mac.com/wp-content/uploads/sites/6/2023/09/iPhone-15-wallpaper-2.png",
"collections": "iphone,ios",
"downloadable": false
"copyright": "For personal use only.",
}, {
"name": "iPhone 15 02",
"author": "iOS Stock",
@berkaytumal
berkaytumal / firefoxroundrectpolyfill.js
Created April 21, 2023 01:32
Firefox Context2D RoundRect Polyfill
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
if (isFirefox) {
CanvasRenderingContext2D.prototype.roundRect = function (
x,
y,
width,
height,
radius = 5,
fill = false,
@berkaytumal
berkaytumal / easing.js
Created April 21, 2023 01:30
Easing Functions
const easing = {
easeInSine(t) {
return -1 * Math.cos(t * (Math.PI / 2)) + 1;
},
easeOutSine(t) {
return Math.sin(t * (Math.PI / 2));
},
easeInOutSine(t) {
return -0.5 * (Math.cos(Math.PI * t) - 1);
},
@berkaytumal
berkaytumal / customtauscrollbar.js
Created May 8, 2021 14:33
Custom Tau Scrollbar
var selector = $("body")
var color = "white"
selector.append($('<canvas width="360" height="360" id="scrollbarcanvas"></canvas>'));var c=document.getElementById("scrollbarcanvas");var ctx=c.getContext("2d");ctx.lineCap='round';back();function scrollperc(){return(getElementScrollScale(selector[0]))}var timer;function getElementScrollScale(domElement){return domElement.scrollTop/(domElement.scrollHeight-domElement.clientHeight)}var pagel;selector.scroll(function(){clearTimeout(timer);$("#scrollbarcanvas").addClass("visible");timer=setTimeout(function(){$("#scrollbarcanvas").removeClass("visible")},500);ctx.save();ctx.setTransform(1,0,0,1,0,0);ctx.clearRect(0,0,c.width,c.height);ctx.restore();pagel=(360/selector[0].scrollHeight);if(pagel<0.25){pagel=0.25}back();front()});var sheet=window.document.styleSheets[0];sheet.insertRule('::-webkit-scrollbar {display: none;}',sheet.cssRules.length);sheet.insertRule('#scrollbarcanvas{transition: all cubic-bezier(0.075, 0.82, 0.165, 1) 500ms;transform: scale(1.1);opacity: 0