<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Smoothly zoom to a zoomlevel when clicking a button ?]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=1867</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1867&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Smoothly zoom to a zoomlevel when clicking a button ?.]]></description>
		<lastBuildDate>Tue, 25 Apr 2023 19:43:30 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Smoothly zoom to a zoomlevel when clicking a button ?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9004#p9004</link>
			<description><![CDATA[<p>Yes, you&#039;re right, I missed that.<br />I updated the script in post #2/</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 25 Apr 2023 19:43:30 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9004#p9004</guid>
		</item>
		<item>
			<title><![CDATA[Re: Smoothly zoom to a zoomlevel when clicking a button ?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9003#p9003</link>
			<description><![CDATA[<p>Thank you Alex.</p><p>I also add the following to the button function and it works great:</p><p><strong>startZoom = OnlineMaps.instance.zoom; </strong></p><p>Thank you!</p>]]></description>
			<author><![CDATA[null@example.com (savvas_6)]]></author>
			<pubDate>Tue, 25 Apr 2023 16:12:08 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9003#p9003</guid>
		</item>
		<item>
			<title><![CDATA[Re: Smoothly zoom to a zoomlevel when clicking a button ?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9002#p9002</link>
			<description><![CDATA[<p>Hi.</p><p>Something like that:<br /></p><div class="codebox"><pre><code>using UnityEngine;

namespace InfinityCode.OnlineMapsSupport
{
    public class SmoothZoom : MonoBehaviour
    {
        public float duration = 1;
    
        private float progress = 1;
        private float targetZoom;
        private float startZoom;

        public void ZoomIn()
        {
            progress = 0;
            startZoom = OnlineMaps.instance.zoom;
            targetZoom = OnlineMaps.instance.zoom + 1;
        }
    
        public void ZoomOut()
        {
            progress = 0;
            startZoom = OnlineMaps.instance.zoom;
            targetZoom = OnlineMaps.instance.zoom - 1;
        }

        private void Update()
        {
            if (progress &gt;= 1) return;
        
            progress += Time.deltaTime / duration;
            if (progress &gt;= 1) progress = 1;
        
            float zoom = Mathf.Lerp(startZoom, targetZoom, progress);
            OnlineMaps.instance.floatZoom = zoom;
            OnlineMaps.instance.Redraw();
        }
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Mon, 24 Apr 2023 18:42:59 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9002#p9002</guid>
		</item>
		<item>
			<title><![CDATA[Re: Smoothly zoom to a zoomlevel when clicking a button ?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9001#p9001</link>
			<description><![CDATA[<p>Hi Alex, I want to add two buttons for zoom in and zoom out. What code should use to achieve a smooth zoom for each button?</p>]]></description>
			<author><![CDATA[null@example.com (savvas_6)]]></author>
			<pubDate>Mon, 24 Apr 2023 17:58:19 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9001#p9001</guid>
		</item>
		<item>
			<title><![CDATA[Re: Smoothly zoom to a zoomlevel when clicking a button ?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=7855#p7855</link>
			<description><![CDATA[<p>Thanks,<br />We added a public bool everyFrame to this script.<br />It works fine !<br />Best regards.<br />Phil</p>]]></description>
			<author><![CDATA[null@example.com (philzmz)]]></author>
			<pubDate>Thu, 04 Nov 2021 08:41:17 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=7855#p7855</guid>
		</item>
		<item>
			<title><![CDATA[Re: Smoothly zoom to a zoomlevel when clicking a button ?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=7851#p7851</link>
			<description><![CDATA[<p>Hello.</p><p>Thanks for the bug report.<br />The problem has been fixed.<br />I have sent you the updated Playmaker Integration Kit by email.<br />The next version of the asset will contain this.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 03 Nov 2021 00:50:23 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=7851#p7851</guid>
		</item>
		<item>
			<title><![CDATA[Smoothly zoom to a zoomlevel when clicking a button ?]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=7847#p7847</link>
			<description><![CDATA[<p>Hello Alex</p><p>Something that I don&#039;t understand : the zoom in OnlineMaps.cs is an int. So I can&#039;t animate this value with a tween float for instance in Playmaker..</p><p>But it is possible to smooth the zoom on mouse event, and I would like to make this possible when I click a button.</p><p>I am wondering how I could make a Playmaker Script to be able to zoom smoothly on the map, instead of zooming by increments ?</p><p>I could do this with a simulated mouse clic, but this is not very effective, a dedicated action would be much better !</p><p>I mean action like &quot;on clic smoothly zoom to this zoomlevel&quot;</p><p>Best regards, Phil</p>]]></description>
			<author><![CDATA[null@example.com (philzmz)]]></author>
			<pubDate>Tue, 02 Nov 2021 19:20:10 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=7847#p7847</guid>
		</item>
	</channel>
</rss>
