Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="container">
  <div id="message">
    <a id="animate" href="#">Transmit</a>
  </div>
</div>
              
            
!

CSS

              
                @import compass

$color: #B95

body
  overflow: hidden
  padding: 0
  margin: 0

p, a
  text-shadow: 0 0 8px rgba(lighten($color, 50%), 0.3)
  font-family: Courier, monospace
  font-smoothing: antialiased
  margin: 0.8em 0
  font-size: 18px
  color: $color

.ghost,
.glitch
  opacity: 0.25

#message
  margin-left: -300px
  margin-top: -130px
  position: absolute
  height: 260px
  width: 600px
  left: 50%
  top: 50%

#animate
  $color: darken(desaturate($color, 10%), 30%) 
  text-shadow: 0 0 8px rgba(lighten($color, 50%), 0.1)
  position: absolute
  color: $color
  bottom: 0
  
#container
  $color1: #20202D
  $color2: #101018
  $color3: #060612
  background: -webkit-radial-gradient(50% 50%, ellipse, $color1 0%, $color2 75%, $color3 100%)
  background: -moz-radial-gradient(50% 50%, ellipse, $color1 0%, $color2 75%, $color3 100%)
  position: absolute
  height: 100%
  width: 100%
  left: 0
  top: 0

  &:before
    pointer-events: none
    position: absolute
    height: 100%
    width: 100%
    content: ''
    left: 0
    top: 0
    background-image: url(data:image/png;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SSFlmuM+g8M9fm8/g9F25aCWuvVfXzkXWOoZ6iIGIjG22V8NOAOT7kqq6ofurqK1qSYlWn9X0m7kdSI1mSzUX5r/3hQ7SLXDzoj6lvMQS7SgblwrcdCmALUkvSqkdEuP9UrdXn6GDnuqkOv1apBeEyscuV20xyZJv8XYAAkqEyAIQyUBQAAAABJRU5ErkJggg==)
              
            
!

JS

              
                MESSAGES = []
MESSAGES.push delay:0,    text:"Incoming transmission..."
MESSAGES.push delay:1200, text:"You don't talk to anybody."
MESSAGES.push delay:2200, text:"You don't interact with anybody."
MESSAGES.push delay:3600, text:"Your whole sense of reality is, pretty warped..."
MESSAGES.push delay:5200, text:"Does it bother you that we're not real?"

$container = $("#container")
$message = $("#message")
$animate = $("#animate")
$paragraph = null

scramble = (element, text, options) ->

  # Default properties.
  defaults =
    probability: 0.2
    glitches: '-|/\\'
    blank: ''
    duration: text.length * 40
    ease: 'easeInOutQuad'
    delay: 0.0

  # Convert the element to a jQuery object and build the settings object.
  $element = $(element)
  settings = $.extend defaults, options

  # Convenience methods.
  shuffle = () -> if Math.random() < 0.5 then 1 else -1
  wrap = (text, classes) -> """<span class="#{classes}">#{text}</span>"""

  # Glitch values.
  glitchText = settings.glitches
  glitchCharacters = glitchText.split ''
  glitchLength = glitchCharacters.length
  glitchProbability = settings.probability
  glitches = ((wrap letter, 'glitch') for letter in glitchCharacters)

  # Ghost values.
  ghostText = $element.text()
  ghostCharacters = ghostText.split ''
  ghostLength = ghostCharacters.length
  ghosts = ((wrap letter, 'ghost') for letter in ghostCharacters)

  # Text values.
  textCharacters = text.split ''
  textLength = textCharacters.length

  # Order and output arrays.
  order = [0...textLength].sort @shuffle
  output = []

  # Build the output array.
  for i in [0...textLength]
    glitchIndex = Math.floor Math.random() * (glitchLength - 1)
    glitchCharacter = glitches[glitchIndex]
    ghostCharacter = ghosts[i] or settings.blank
    addGlitch = Math.random() < glitchProbability
    character = if addGlitch then glitchCharacter else ghostCharacter
    output.push character

  # Animate the text.
  object = value:0
  target = value:1
  parameters =
    duration:settings.duration
    ease:settings.ease
    step: ->
      progress = Math.floor object.value * (textLength - 1)
      for i in [0..progress]
        index = order[i]
        output[index] = textCharacters[index]
      $element.html output.join ''
    complete: ->
      $element.html text

  # Animate the text.
  $(object).delay(settings.delay).animate target, parameters



animate = () ->
  for data, index in MESSAGES
    element = $paragraph.get index
    element.innerText = ''
    options = delay: data.delay
    scramble element, data.text, options
  return

initialise = () ->
  $animate.click animate
  $message.append "<p>" for text, index in MESSAGES
  $paragraph = $container.find "p"
  animate()
  return

initialise()

              
            
!
999px

Console