radialGravityField(position:)
Creates and returns a field behavior object that models a radial gravitational force.
Declaration
class func radialGravityField(position: CGPoint) -> SelfParameters
- position:
The location of the gravitation force in the reference coordinate system. You can change this value later by modifying the Position property.
Return Value
A field behavior object that applies a gravitational force to items with mass.
Discussion
This field creates a gravitational force at the specified point in the referenced coordinate system. Dynamic items with mass are attracted to the specified point with a force that is proportional to their distance from the point.
When setting the strength of the field, positive values attract items to the field’s position and negative values repel items. The force on the object can be determined by the equation F = ma. The force equals the mass of the object multiplied by the acceleration imposed by the gravitational field, which is determined by the strength of the field and the distance of the item from the field’s origin.