cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              html {
  min-height: 100vh;
}
body {
  background: #fff;
  font-family: 'Open Sans', sans-serif;
  font-weight: 300;
  font-size: 14px;
	padding: 20px;
}
h1 {
  font-size: 2.5em;
}
a {
  color: #02bfe6;
  font-weight: bold;
  text-decoration: none;
}
strong {
  font-weight: bold;
}
.logo {
  width: 400px;
  max-width: 100%;
	margin: 0 auto;
	display: block;
}

.FormInput {
  display: inline-block;
}
form > div {
  margin-bottom: 1em;
}
h6 {
  font-size: 0.8em;
  font-weight: bold;
  margin-bottom: 0.5em;
}
label {
  display: block;
}
radiogroup {
  padding: 10px;
  border: 1px solid rgba(0,0,0,0.1);
  display: inline-block;
  border-radius: 3px;
}
input,
textarea,
select {
  font-size: 15px;
  padding: 5px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.2);
  margin-bottom: 2px;
}
.FormInput.-error input,
.FormInput.-error textarea,
.FormInput.-error select {
  border-color: #f00;
}
.FormError {
  color: #f00;
  font-size: 12px;
  font-weight: bold;
  margin: 5px;
}
em {
  font-style: italic;
}
.nested {
  padding: 10px;
}
.nested > div {
  background: rgba(0,0,0,0.05);
  border-radius: 5px;
  margin-bottom: 5px;
  padding: 10px;
}
.form_wrapper{
	padding: 20px;
}

.react-resizable{
  max-width: 100%;
}

            
          
!
            
              const { Animate, Transition } = window.ReactMove

class MyAnimatedComponent extends React.Component {
  constructor () {
    super()
    this.state = {
      items: makeItems()
    }
  }
  render () {
    return (
      <div>
        <button
          onClick={() => this.setState({
            items: makeItems()
          })}
        >
          Randomize Data
        </button>

				<br />
				<br />

        <div
          style={{
            height: '320px'
          }}
        >
          {this.state.items.map((d, i) => (
            <Animate
              key={i}
              default={{
                scale: 0,
                color: 'blue',
                rotate: 0
              }}
              data={d}
            >
              {data => {
                return (
                  <div
                    style={{
                      float: 'left',
                      width: '100px',
                      height: '100px',
                      display: 'flex',
                      alignItems: 'center',
                      justifyContent: 'center',
                      fontWeight: 'bold',
                      color: 'white',
                      textAlign: 'center',
                      borderRadius: ((data.rotate / 360) * 100) + 'px',
                      transform: `translate(${data.scale * 50}%, ${data.scale * 50}%) scale(${data.scale}) rotate(${data.rotate}deg)`,
                      background: data.color
                    }}
                  >
                    {Math.round(data.scale * 100)}
                  </div>
                )
              }}
            </Animate>
          ))}
        </div>
      </div>
    )
  }
}

class MyTransitionedComponent extends React.Component {
  constructor () {
    super()
    this.state = {
      items: makeTransitionItems()
    }
  }
  render () {
    const {
      items
    } = this.state
    return (
      <div>
        <button
          onClick={() => this.setState({
            items: makeTransitionItems()
          })}
        >
          Randomize Data
        </button>

        <br />
        <br />

        <Transition
          data={items}
          getKey={d => d.value}
          update={d => ({
            translate: 1,
            opacity: 1,
            color: 'grey'
          })}
          enter={d => ({
            translate: 0,
            opacity: 0,
            color: 'blue'
          })}
          leave={d => ({
            translate: 2,
            opacity: 0,
            color: 'red'
          })}
          stagger={100}
          staggerGroups // staggers items relative to their 'entering', 'updating', or 'leaving' group
        >
          {data => (
            <div style={{height: (20 * 10) + 'px'}}>
              {data.map(d => (
                <div
                  key={d.key}
                  style={{
                    fontWeight: 'bold',
                    position: 'absolute',
                    transform: `translate(${100 * d.state.translate}px, ${20 * d.key}px)`,
                    color: d.state.color,
                    opacity: d.state.opacity
                  }}
                >
                  {d.key} - {Math.round(d.progress * 100)}
                </div>
              ))}
            </div>
          )}
        </Transition>
      </div>
    )
  }
}

const Demo = (props) => {
	return (
		<div>
			<h1>React-Move - Basic Examples</h1>
			<MyAnimatedComponent />
			<br />
			<br />
			<br />
			<br />
			<MyTransitionedComponent />
			<br />
			<br />
			<h1>For more examples, <a href="https://react-move.js.org" target="_blank">see our react storybook</a></h1>
		</div>
	)
}

ReactDOM.render(<Demo />, document.getElementById('root'))

function makeItems () {
  return _.range(5).map(d => {
    const colorNum = Math.random()
    const color = colorNum > 0.6 ? 'red' : colorNum > 0.3 ? 'gold' : 'blue'
    return {
      scale: Math.random() * 1,
      color,
      rotate: Math.random() > 0.5 ? 360 : 0
    }
  })
}

let include
function makeTransitionItems () {
  include = !include
  return _.filter(
    _.map(_.range(10), d => ({
      value: d
    })),
    // (d, i) => include
    (d, i) => Math.random() * 10 > i
  )
}
            
          
!
999px
Loading ..................

Console