Article

About Component Behaviors

Learn how to affect components’ reactions to device motion and scrolling.

Overview

In Apple News Format, a behavior defines the physics of a component and its context and determines how a component responds to user actions. A behavior can specify the gravitational effect of a component or how the component reacts to the motion of the device. For example, a behavior can move the background of a component slightly more slowly than the user is scrolling.

Apple News Format has these behaviors for components:

  • BackgroundMotion. Causes the background of a component to move in the opposite direction from the motion of the device.

  • BackgroundParallax. Causes the background of a component to move slightly more slowly than the user’s scroll speed.

  • Motion. Causes a component to react to movement of the device.

  • Parallax. Causes a component to move at a specific speed.

  • Springy. Causes a component to act as if it is held in place with a short spring.

A behavior is different from an animation. A behavior is persistent and always in effect as long as the user is viewing the article. An animation occurs only once each time the user views the article. See About Component Animations.

See Also

Behaviors

object Behavior

Properties shared by all the behaviors you can use to affect how components react to device motion and scrolling.

object BackgroundMotion

The behavior whereby the background of a component moves in the opposite direction from the motion of the device.

object BackgroundParallax

The behavior whereby the background of a component moves slightly slower than the user’s scroll speed.

object Motion

The behavior whereby a component reacts to the motion of the user’s device.

object Parallax

The behavior whereby a component moves at a speed different from the scroll speed.

object Springy

The behavior whereby a component acts as if it is on a short spring.