JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/prop-types@15.5.10/prop-types.js"></script>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
Babel + JSX
render() {
const xCoord = 20 // sun's initial x and y coordinates
const yCoord = 150 const earthSize = 35 //earth size used as reference for planet sizes
const sunSize = earthSize * 25 //sun's size used as variable to adjust orbital coordinate of planets
const orbitDefault = sunSize
return (
<Animated.View style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, justifyContent: 'center', alignItems: 'center' }}>
<Image style={{ height: 850, width: 850, position: 'absolute', top: 0, left: 0 }} source={require('../public/astronomy.jpg')} />
<ScrollView
bouncesZoom={true}
contentContainerStyle={styles.container}
minimumZoomScale={'0'}
maximumZoomScale={'100'}
centerContent={true}>
<Planet x={xCoord} y={yCoord + (sunSize / 2)} height={earthSize} width={earthSize} orbitSize={orbitDefault * 6} orbitSpeedInDays={365}
planetPicture={require('../public/earth.png')} name={'Earth'} />
<Planet x={xCoord} y={yCoord + (sunSize / 2)} height={earthSize * 0.95} width={earthSize * 0.95} orbitSize={orbitDefault * 4}
orbitSpeedInDays={225} planetPicture={require('../public/venus.png')} name={'Venus'} />
<Planet x={xCoord} y={yCoord} height={sunSize} width={sunSize} orbitSize={0} orbitSpeedInDays={365}
planetPicture={require('../public/sun_pic.png')} name={'Sun'} />
</ScrollView>
</Animated.View> )