updated docs for PV_Random and PV_Cos

liquid_container
David Dormagen 2016-02-27 12:39:18 +01:00
parent 3d71dfbfa9
commit 85fad425e2
4 changed files with 77 additions and 1 deletions

View File

@ -57,6 +57,8 @@
<funclink>PV_KeyFrames</funclink>
<funclink>PV_Wind</funclink>
<funclink>PV_Gravity</funclink>
<funclink>PV_Sin</funclink>
<funclink>PV_Cos</funclink>
</text>
<text>
<table>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>PV_Cos</title>
<category>Particles</category>
<version>8.0 OC</version>
<syntax>
<rtype>array</rtype>
<params>
<param>
<type>int</type>
<name>value</name>
<desc>Value or value provider to calculate the cosine of. The result of <funclink>PV_Linear</funclink> can be used to evaluate the cosine function linearly over time.</desc>
</param>
<param>
<type>int</type>
<name>amplitude</name>
<desc>Amplitude of result. May be a value or value provider.</desc>
</param>
<param>
<type>int</type>
<name>offset</name>
<desc>Offset added to result. May be a value or value provider. Defaults to zero.</desc>
<optional />
</param>
</params>
</syntax>
<desc>The value will is calculates as cos(value) * amplitude + offset with value given in degrees.</desc>
<remark>See the <emlink href="particle/index.html">particle documentation</emlink> for further explanations of the particle system.</remark>
<remark>See <funclink>PV_Random</funclink> for another example with PV_Cos.</remark>
<related>
<funclink>CreateParticle</funclink>
<funclink>PV_Sin</funclink>
<funclink>PV_Direction</funclink>
<funclink>PV_Random</funclink>
<funclink>PV_Step</funclink>
<funclink>PV_Linear</funclink>
<funclink>PV_Speed</funclink>
<funclink>PV_KeyFrames</funclink>
</related>
</func>
<author>Zapper</author><date>2016-02</date>
</funcs>

View File

@ -27,12 +27,37 @@
<name>reroll_interval</name>
<desc>Interval in frames after which a new random number will be drawn.</desc>
<optional />
</param>
<param>
<type>int</type>
<name>seed</name>
<desc>Particle-local seed that is used for the random rool. Can be used to draw the same random number two times (see example).</desc>
<optional />
</param>
</params>
</syntax>
<desc>The value will be a random number in the interval from start_value to (not including) end_value. The values in between are not whole integers, but are also in fraction of integers. This means that PV_Random(0, 1) can not only return one value (the 0) but a lot of different values in the interval between 0 and 1.</desc>
<remark>See the <emlink href="particle/index.html">particle documentation</emlink> for further explanations of the particle system.</remark>
<related>
<examples>
<example>
<code><funclink>CreateParticle</funclink>("MagicRing", 0, 0, PV_Random(-100, 100), -20, 100, {Prototype = Particles_Glimmer(), Size = PV_Random(0, 3, 10)}, 100);</code>
<text>Creates 100 particles with a random speed in X direction and a random size (which changes every ten frames).</text>
</example>
<example>
<code>
var min_speed = 50;
var max_speed = 100;
var min_angle = 0;
var max_angle = 360;
<funclink>CreateParticle</funclink>("SphereSpark", 0, 0,
<funclink>PV_Sin</funclink>(<funclink>PV_Random</funclink>(min_angle, max_angle, 0, 1), <funclink>PV_Random</funclink>(min_speed, max_speed, 0, 2)),
<funclink>PV_Cos</funclink>(<funclink>PV_Random</funclink>(min_angle, max_angle, 0, 1), <funclink>PV_Random</funclink>(min_speed, max_speed, 0, 2)),
PV_Random(10, 200),
Particles_Glimmer(), 400);</code>
<text>Uses the particle-local seed to draw the same angle and radius for the X and Y speed of the particle. This leads to a radial distribution (instead of a square). The seed parameter is set to the same number (here 1 and 2) where the same result should be drawn.</text>
</example>
</examples>
<related>
<funclink>CreateParticle</funclink>
<funclink>PV_Linear</funclink>
<funclink>PV_Direction</funclink>
@ -40,6 +65,7 @@
<funclink>PV_Speed</funclink>
<funclink>PV_KeyFrames</funclink>
<funclink>PV_Sin</funclink>
<funclink>PV_Cos</funclink>
<funclink>PC_Die</funclink>
<funclink>PC_Bounce</funclink>
</related>

View File

@ -30,6 +30,7 @@
</syntax>
<desc>The value will is calculates as sin(value) * amplitude + offset with value given in degrees.</desc>
<remark>See the <emlink href="particle/index.html">particle documentation</emlink> for further explanations of the particle system.</remark>
<remark>See <funclink>PV_Random</funclink> for another example with PV_Sin.</remark>
<examples>
<example>
<code><funclink>CreateParticle</funclink>("MagicRing", 0, 0, 0, 0, 100, {R=0xff,G=0x00,B=0x30, Size = PV_Sin(<funclink>PV_Linear</funclink>(0,180),10,0)}, 1);</code>
@ -38,6 +39,7 @@
</examples>
<related>
<funclink>CreateParticle</funclink>
<funclink>PV_Cos</funclink>
<funclink>PV_Direction</funclink>
<funclink>PV_Random</funclink>
<funclink>PV_Step</funclink>