Skip to content

Instantly share code, notes, and snippets.

@didacus
didacus / chaining.js
Created February 4, 2019 17:21
Framer X - Chaining animations
export const ScaledAwait: Override = () => {
return {
scale: data.scale,
onTap: async () => {
await animate.spring(data.scale, 0.5).finished
await animate.spring(data.scale, 1.5).finished
await animate.spring(data.scale, 0.5).finished
console.log('finished!')
},
}
@didacus
didacus / reuse-animation.js
Last active February 5, 2019 11:39
Framer X - Reuse animations - create by Jay Stakelon
import { Data, animate, Override, Animatable } from "framer";
// Set an array to keep each scaleValues
const data = Data({ scaleValues: [] });
export const Scale: Override = props => {
// Add to the array the id and the animation value
data.scaleValues.push({ id: props.id, scaleValue: Animatable(1) });
return {
// Pass the current id to the function
@didacus
didacus / property.js
Created February 7, 2019 08:53
Framer X — Property Controls
import * as React from 'react'
import { PropertyControls, ControlType } from 'framer'
// Define type of property
export interface Props {
text: string,
color: string,
boolean: boolean,
numberA: number,
numberB: number,
@didacus
didacus / times.js
Created February 7, 2019 08:59
ES2015 Spread operator — Do it 'x' times
const dotIt = number => {
const res = [ ...Array(number) ].map((_, i) => {
return i * number
})
return res
}
@didacus
didacus / css.js
Created February 7, 2019 12:39
ReactJS (Framer X) — Extends CSS properties
const styles = {
container: {
position: 'relative',
height: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center',
color: '#8855FF',
@didacus
didacus / watch-changes.js
Last active June 12, 2019 14:03
ReactJS — Watch for changes and fetch
// New
const [clear, setClear] = useCycle(false, true)
useEffect(() => {
//props to watch for changes
const watchlist = ["clear"]
if (watchlist.some(prop => props[prop] !== clear)) {
console.log("clear is", clear, "props.clear is", props.clear)
}
@didacus
didacus / Parallax.tsx
Created May 16, 2019 07:58
Framer X — Parallax
import { Override, motionValue, useTransform } from "framer"
const contentOffsetY = motionValue(0)
// Apply this override to your scroll component
export function TrackScroll(): Override {
return { contentOffsetY: contentOffsetY }
}
// Apply this override to your parallax layer
@didacus
didacus / araxa.json
Created January 10, 2020 22:10
ARAXA.json
{"v":"5.5.10","fr":30,"ip":0,"op":360,"w":1920,"h":1920,"nm":"main","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"ARAXA Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[960,960,0],"ix":2},"a":{"a":0,"k":[670.5,55.5,0],"ix":1},"s":{"a":0,"k":[142,142,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[43.568,-54.5],[24.961,-54.5],[4.838,-14.406],[23.756,-14.406]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-6.486,9.251],[-25.094,9.251],[-47.443,54.5],[-28.524,54.5]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-43.179,-54.5],[-20.829,-54.5],[47.443,54.5],[24.9
@didacus
didacus / grid.js
Created January 12, 2020 12:43
P3 — Basic grid based on size
void setup() {
size(800,800);
}
void draw() {
int tilesX = 10;
int tilesY = 1;
int tileW = int(width/tilesX);
@didacus
didacus / random_colour.js
Created January 29, 2020 22:26
Random colour function
function getRandomColor() {
var letters = "0123456789ABCDEF";
var color = "#";
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}