AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

copy

介绍

copy函数用于将一个区域的内容复制到另一个区域。

copy(from, to);

参数说明:

  • from:要复制的区域。
  • to:要粘贴到的区域。

使用方法

copy(document.getElementById('source'), document.getElementById('destination'));

示例

以下示例演示了如何使用copy函数进行复制操作。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>copy函数示例</title>
</head>
<body>
  <div id="source">
    <p>这是要复制的文本</p>
  </div>
  <div id="destination">
    <p>这里是要粘贴的位置</p>
    <button onclick="paste()">粘贴</button>
  </div>

  <script src="yuka.js"></script>
  <script>
    function paste() {
      copy(document.getElementById('source'), document.getElementById('destination'));
    }
  </script>
</body>
</html>

注意事项

  • from和to参数必须是DOM元素。
  • 复制的内容只包括元素的内部HTML,不包括元素本身的标记。
  • 复制的内容是原来的内容,不会随着源内容的变化而变化。