-
-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c938fd9
commit 19716af
Showing
4 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as React from "react" | ||
import { motion } from "framer-motion" | ||
|
||
/** | ||
* An example of the Motion keyframes syntax. | ||
*/ | ||
|
||
const style = { | ||
width: 100, | ||
height: 100, | ||
backgroundColor: "#f00", | ||
x: 0, | ||
borderRadius: 20, | ||
color: "rgba(0,0,0,0)", | ||
} | ||
|
||
export const App = () => { | ||
return ( | ||
<div style={{ "--a": "#00F", "--b": 360, "--c": 100 } as any}> | ||
<motion.div | ||
animate={{ | ||
backgroundColor: "var(--a)", | ||
rotateX: "var(--b)", | ||
x: "var(--c)", | ||
y: "var(--c)", | ||
}} | ||
style={style} | ||
onUpdate={console.log} | ||
> | ||
a | ||
</motion.div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as React from "react" | ||
import { motion, useMotionValue } from "framer-motion" | ||
|
||
/** | ||
* An example of the Motion keyframes syntax. | ||
*/ | ||
|
||
const style = { | ||
width: 100, | ||
height: 100, | ||
backgroundColor: "#f00", | ||
x: 0, | ||
borderRadius: 20, | ||
} | ||
let isFirstFrame = true | ||
export const App = () => { | ||
const content = useMotionValue("") | ||
|
||
return ( | ||
<div style={{ "--a": "#00F", "--b": "360deg", "--c": 2 } as any}> | ||
<motion.div | ||
animate={{ | ||
originX: 0, | ||
originY: 0, | ||
backgroundColor: "var(--a)", | ||
scale: "var(--c)", | ||
}} | ||
style={style} | ||
onUpdate={({ scale }) => { | ||
if (isFirstFrame) { | ||
content.set(scale === "2" ? "Fail" : "Success") | ||
} | ||
isFirstFrame = false | ||
}} | ||
> | ||
{content} | ||
</motion.div> | ||
</div> | ||
) | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/framer-motion/cypress/integration/css-var-numbers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
describe("animate() x layout prop timing", () => { | ||
it("animate() plays as expected when layout prop is present", () => { | ||
cy.visit("?test=animate-layout-timing") | ||
.wait(1000) | ||
.get("#action") | ||
.trigger("click", 1, 1, { force: true }) | ||
.wait(600) | ||
.get("#result") | ||
.should(([$element]: any) => { | ||
expect($element.value).to.equal("Success") | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters