This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ViewController: UIScrollViewDelegate { | |
@IBAction func pageControlValueChanged(_ sender: UIPageControl) { | |
let pageSize: CGSize = self.scrollView.bounds.size | |
let pageOrigin: CGPoint = CGPoint(x: CGFloat(sender.currentPage) * pageSize.width, y: 0.0) | |
// Scroll to corresponding page when current page index of page control is changed | |
self.scrollView.scrollRectToVisible(CGRect(origin: pageOrigin, size: pageSize), animated: true) | |
} | |
func scrollViewDidScroll(_ scrollView: UIScrollView) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ViewController: UIScrollViewDelegate { | |
/// Set scale transformation to each card view according to current content offset of scroll view | |
private func setScaleOfCards() { | |
let pageWidth: CGFloat = self.scrollView.bounds.width | |
let minScale: CGFloat = 0.8 | |
let scrollOffsetX: CGFloat = self.scrollView.contentOffset.x | |
for (cardIndex, cardView) in self.cards.enumerated() { | |
let pageOffsetX: CGFloat = CGFloat(cardIndex) * pageWidth | |
let offsetDiffRatio: CGFloat = min(1.0, abs(pageOffsetX - scrollOffsetX) / pageWidth) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import sys | |
import os | |
import cv2 | |
import json | |
# default resized icon imag format | |
# could be changed to jpg | |
RESIZED_ICON_IMAGE_FORMAT = "png" |