-
Notifications
You must be signed in to change notification settings - Fork 2
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
74888fe
commit 4d31269
Showing
28 changed files
with
7,042 additions
and
10 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,19 +1,18 @@ | ||
<h1 align="center"> | ||
Grid Magnification effect in React Native Skia 🦄 | ||
Exploring Skia 🦄 | ||
</h1> | ||
|
||
<a href="https://youtu.be/zV0SGIlrtug" target="_blank"> | ||
<img src="https://github.com/enzomanuelmangano/skia-grid-magnification/blob/main/.assets/skia-grid.png" title="skia-grid-magnification"> | ||
<img src="https://github.com/enzomanuelmangano/exploring-skia/blob/main/.assets/thumbnail.png" title="exploring-skia"> | ||
</a> | ||
|
||
[Check out the video tutorial!](https://youtu.be/zV0SGIlrtug) | ||
What's up mobile devs? | ||
This is a repository where I explore the (React Native Skia)[https://github.com/Shopify/react-native-skia] package, by creating some interesting animations and UIs. | ||
If you find this repo useful, feel free to support me on [Patreon](https://www.patreon.com/reactiive). | ||
|
||
## Inspiration | ||
# Tutorials | ||
|
||
- [Philip Davis' Tweet](https://twitter.com/philipcdavis/status/1549409119131488256?s=20&t=PmMsvQBgsruGVeAtooeLcA) | ||
Every source code is fully explained in the following tutorials: | ||
|
||
## Does this sound interesting? | ||
|
||
Then I suggest you check out my [YouTube](https://www.youtube.com/c/Reactiive) channel. I create React Native contents and continually update a series on Reanimated called ["Animate with Reanimated"](https://github.com/enzomanuelmangano/animate-with-reanimated). | ||
|
||
Do you want to support me? [Buymeacoffee](https://www.buymeacoffee.com/reactiive) | ||
- [Skia Grid Magnification](https://youtu.be/zV0SGIlrtug) | ||
- [Metaball Animation](https://youtu.be/HOxZegqnDC4) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,17 @@ | ||
node_modules/ | ||
.expo/ | ||
dist/ | ||
npm-debug.* | ||
*.jks | ||
*.p8 | ||
*.p12 | ||
*.key | ||
*.mobileprovision | ||
*.orig.* | ||
web-build/ | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# Temporary files created by Metro to check the health of the file watcher | ||
.metro-health-check* |
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,82 @@ | ||
import { StatusBar, Text, View, useWindowDimensions } from 'react-native'; | ||
import React, { useMemo } from 'react'; | ||
import { | ||
Blur, | ||
Canvas, | ||
Circle, | ||
ColorMatrix, | ||
Group, | ||
Paint, | ||
SweepGradient, | ||
runSpring, | ||
useValue, | ||
vec, | ||
} from '@shopify/react-native-skia'; | ||
import Touchable, { useGestureHandler } from 'react-native-skia-gesture'; | ||
|
||
const RADIUS = 80; | ||
|
||
export default function App() { | ||
const { width: windowWidth, height: windowHeight } = useWindowDimensions(); | ||
|
||
const cx = useValue(windowWidth / 2); | ||
const cy = useValue(windowHeight / 2); | ||
|
||
const gestureHandler = useGestureHandler<{ | ||
x: number; | ||
y: number; | ||
}>({ | ||
onStart: (_, context) => { | ||
context.x = cx.current; | ||
context.y = cy.current; | ||
}, | ||
onActive: ({ translationX, translationY }, context) => { | ||
cx.current = translationX + context.x; | ||
cy.current = translationY + context.y; | ||
}, | ||
onEnd: () => { | ||
runSpring(cx, windowWidth / 2); | ||
runSpring(cy, windowHeight / 2); | ||
}, | ||
}); | ||
|
||
const layer = useMemo(() => { | ||
return ( | ||
<Paint> | ||
{/* pixelOpacity > blurredOpacity * 60 - 30 */} | ||
<Blur blur={30} /> | ||
<ColorMatrix | ||
matrix={[ | ||
// R, G, B, A, Bias (Offset) | ||
// prettier-ignore | ||
1, 0, 0, 0, 0, | ||
// prettier-ignore | ||
0, 1, 0, 0, 0, | ||
// prettier-ignore | ||
0, 0, 1, 0, 0, | ||
// prettier-ignore | ||
0, 0, 0, 60, -30, | ||
]} | ||
/> | ||
</Paint> | ||
); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<StatusBar barStyle={'light-content'} /> | ||
<Touchable.Canvas | ||
style={{ | ||
flex: 1, | ||
backgroundColor: '#111', | ||
}} | ||
> | ||
<Group layer={layer}> | ||
<Touchable.Circle {...gestureHandler} cx={cx} cy={cy} r={RADIUS} /> | ||
<Circle cx={windowWidth / 2} cy={windowHeight / 2} r={RADIUS} /> | ||
<SweepGradient c={vec(0, 0)} colors={['cyan', 'magenta', 'cyan']} /> | ||
</Group> | ||
</Touchable.Canvas> | ||
</> | ||
); | ||
} |
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,30 @@ | ||
{ | ||
"expo": { | ||
"name": "metaball", | ||
"slug": "metaball", | ||
"version": "1.0.0", | ||
"orientation": "portrait", | ||
"icon": "./assets/icon.png", | ||
"userInterfaceStyle": "light", | ||
"splash": { | ||
"image": "./assets/splash.png", | ||
"resizeMode": "contain", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"assetBundlePatterns": [ | ||
"**/*" | ||
], | ||
"ios": { | ||
"supportsTablet": true | ||
}, | ||
"android": { | ||
"adaptiveIcon": { | ||
"foregroundImage": "./assets/adaptive-icon.png", | ||
"backgroundColor": "#ffffff" | ||
} | ||
}, | ||
"web": { | ||
"favicon": "./assets/favicon.png" | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,6 @@ | ||
module.exports = function(api) { | ||
api.cache(true); | ||
return { | ||
presets: ['babel-preset-expo'], | ||
}; | ||
}; |
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,25 @@ | ||
{ | ||
"name": "metaball", | ||
"version": "1.0.0", | ||
"main": "node_modules/expo/AppEntry.js", | ||
"scripts": { | ||
"start": "expo start", | ||
"android": "expo start --android", | ||
"ios": "expo start --ios", | ||
"web": "expo start --web" | ||
}, | ||
"dependencies": { | ||
"@shopify/react-native-skia": "0.1.172", | ||
"expo": "~48.0.15", | ||
"expo-status-bar": "~1.4.4", | ||
"react": "18.2.0", | ||
"react-native": "0.71.8", | ||
"react-native-skia-gesture": "^0.1.7" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.20.0", | ||
"@types/react": "~18.0.14", | ||
"typescript": "^4.9.4" | ||
}, | ||
"private": true | ||
} |
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,6 @@ | ||
{ | ||
"extends": "expo/tsconfig.base", | ||
"compilerOptions": { | ||
"strict": true | ||
} | ||
} |
Oops, something went wrong.