Skip to content

Instantly share code, notes, and snippets.

View jordandobson's full-sized avatar
🥽

Jordan Dobson jordandobson

🥽
View GitHub Profile
@assassinave
assassinave / utils-modulate-framerx.tsx
Created December 16, 2018 16:50
Framer X - Utils Modulate
// Framer X Utils.modulate equivalent
function modulate(value, rangeA, rangeB, limit = false) {
const [fromLow, fromHigh] = rangeA;
const [toLow, toHigh] = rangeB;
const result = toLow + ((value - fromLow) / (fromHigh - fromLow)) * (toHigh - toLow);
if (limit === true) {
if (toLow < toHigh) {
if (result < toLow) {
return toLow;
@jonastreub
jonastreub / useGyro.ts
Created May 12, 2019 12:13
A hook making it fun to work with the gyroscope
import { useState, useEffect } from "react"
interface WorldOrientation {
/** A number representing the motion of the device around the z axis, expressed in degrees with values ranging from 0 to 360. */
alpha: number
/** A number representing the motion of the device around the x axis, expressed in degrees with values ranging from -180 to 180. This represents a front to back motion of the device. */
beta: number
/** A number representing the motion of the device around the y axis, expressed in degrees with values ranging from -90 to 90. This represents a left to right motion of the device. */
gamma: number
}
@davo
davo / Colors.tsx
Created May 21, 2019 21:38
Reusing Framer X Shared Colors on a Function Component
import * as React from 'react'
import { Stack, Frame } from 'framer'
import { colors } from './canvas'
export function Colors() {
const [colorsTokens] = React.useState(() => {
return Object.keys(colors).map(key => colors[key])
})
return (
@addisonschultz
addisonschultz / reactchildren.tsx
Last active September 14, 2023 01:15
Cloning React Children
import * as React from "react";
import { Frame, addPropertyControls, ControlType } from "framer";
export function Component({ childComponent }) {
return (
<div style={{ width: "100%" }}>
{React.Children.map(childComponent, (child, index) => {
return React.cloneElement(child, {
width: "100%",
key: index,