How to make the Image label rotate separately in svg
See original GitHub issueimport React, { Component } from 'react';
import {
StyleSheet,
View,
Animated, Easing
} from 'react-native';
import Svg,{
Text,
Image,
} from 'react-native-svg';
const AnimatedSvg = Animated.createAnimatedComponent(Svg);
export default class App extends Component {
constructor() {
super();
this.RotateValueHolder = new Animated.Value(0);
}
componentDidMount() {
this.StartImageRotateFunction();
}
StartImageRotateFunction() {
this.RotateValueHolder.setValue(0);
Animated.timing(this.RotateValueHolder, {
toValue: 1,
duration: 10000,
easing: Easing.linear,
useNativeDriver:true
}).start(()=>this.StartImageRotateFunction());
}
render() {
return (
<View style={styles.container}>
<AnimatedSvg
width="300"
height="300"
style={{
transform: [
{
rotate: this.RotateValueHolder.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg'],
}),
},
],
}}
>
<Image
width="100%"
height="100%"
href={require('./src/assets/bg.png')}
/>
<Text
x="50"
y="50"
textAnchor="middle"
fontWeight="bold"
fontSize="16"
fill="blue"
>HOGWARTS</Text>
</AnimatedSvg>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});
How to make the iamge tag rotate alone not complete <Svg>? I have tried const AnimatedImage = Animated.createAnimatedComponent(Image); and put <svg> style move this const it’s not working
Issue Analytics
- State:
- Created 5 years ago
- Comments:17
Top Results From Across the Web
How to make the Image label rotate separately in svg #940
How to make the iamge tag rotate alone not complete ? I have tried const AnimatedImage = Animated.createAnimatedComponent(Image); and put style ...
Read more >Transforms on SVG Elements | CSS-Tricks
In the case of SVG transform attributes, the rotation function is a bit different – rotate(angle[ x y]) . The angle value works...
Read more >Reversing the flip and rotation of an image fill in a path that is ...
If the path is only rotated (in this case, 315 degrees), it's easy to unrotate the image by just reversing the angle in...
Read more >SVG images, label rotation, mockups gallery wizard
This launches the website in a separate tab and lets you browse available components. Clicking a download link launches the Mockups Gallery ...
Read more >SVG Tutorial – How to Code Images with 7 Examples
The SVG tag represents the frame of the image and every SVG element has to come within an SVG tag. The same is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am going to try,
I am very honored to meet you. @msand
Hello.
I arrived to this question after trying different approaches to animate the rotation of a Path in a Svg. I have tried the examples above in the expo playground and I have noticed a difference between using Svg from expo and from ‘react-native-svg’.
In my plain react-native project I got the rotate animation in a Svg component but not in any of the children. Without expo, AnimatedG or any other Animated component besides AnimatedSvg is not working to me.